<?php
defined('IN_PHPCMS') or exit('No permission resources.');
pc_base::load_app_class('admin','admin',0);
pc_base::load_sys_class('form', '', 0);
pc_base::load_app_func('util');
pc_base::load_sys_class('format','',0);
class liuyan {
    public function __construct()
    {
        $this->db = pc_base::load_model('liuyan_model');
    }

    public function add()
    {
        if($_POST['dosubmit']){
            /* if($_POST['code']!=$_SESSION['code']){
                exit('验证码输入错误');
            } */

			/* if($_POST['username']=='' || $_POST['phone']=='' || $_POST['area']=='' || $_POST['fee']=='' || $_POST['username']=='您的称呼' || $_POST['phone']=='您的电话' || $_POST['area']=='区域' || $_POST['fee']=='预算'){
                exit('请填写完整');
            } */
			if(!preg_match("/^(1)[0-9]{10}$/",$_POST['phone'])){
                exit('手机号码格式错误');
            }
            unset($_POST['dosubmit']);
            unset($_POST['code']);
            $_POST['addtime']=time();
			if($this->db->insert($_POST)){
				exit("ok");
			}else{
				exit("提交失败，请联系管理员");
			}

        }else{
            exit('提交错误，请联系管理员');
        }
    }
}